function [ close, high, low, open ] = GetDataIB( ticker,secType )
%addpath ../6-Broker
global orderID
global cuenta

connectTWS;%we connect to the broker to obtain data

%secType= 'STK'; %% What kind of security to request, e.g. STK, option, FUTURE, CASH(forex), comodity
contract=createcontract(ticker,secType); %Create Contract to ask

EndDate = ''; %Today, Last timepoint to be downloaded yyyymmdd hh:mm:ss
Duration = '1 Y'; % How long to look back from EndDate (S,D,W,M,Y)
BarSize = '1 day'; % Bar size can be 1,5,15,or 30 sec(s); 1,2,3,5,15, or 30 min(s); 1 hour; 1 day; etc
global HistData;
 if strcmp('STK',secType)
    tradeormid='TRADES';
 end
 if strcmp('FUT',secType)
    tradeormid='TRADES';
    contract=createcontract(ticker,secType,'201212','GLOBEX'); %Crea el contrato a utilizar
 end
 if strcmp('CASH',secType)
     tradeormid='MIDPOINT';
 end
RequestHistory(1,contract,EndDate,Duration,BarSize,tws,tradeormid); 
orderID=orderID+1;
%tws.reqIds(orderID);
close=HistData.Close;
open=HistData.Open;
high= HistData.High;
low=HistData.Low;
tws.disconnect;


end

